// 题解：求一个图中最大平均权值回路。
//
// 题解：要求maximum ans = sigma(wi)/n，n为环上顶点数目，那么等价于
//       sigma(wi) - n * ans = 0，这里就有单调性，可以二分答案，
//       然后将每条边减去二分的答案再看有没有负环。
//       这里特别就要注意二分的方向，如果是要求负环，那么初始就要将所有边
//       为负，然后是加上这个差量才是判负环，如果还是跟刚刚说的一样，其实
//       是判有没有正环。
//
//       思考的时候应该多举一些例子，辅助。比如想象下图中有个权为12的自环，
//       和权为13的自环就能很容易想明白了。
//
// run: time $exec < bfdiff.in
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

template <class T>
struct shortest_path_faster_algorithm
{
	typedef T value_type;
	typedef int size_type;

	struct edge {
		edge(size_type from, size_type to, value_type cost) : from(from), to(to), cost(cost) {}
		size_type from, to;
		value_type cost;
	};

	typedef std::vector<edge> adj_edge;
	typedef typename adj_edge::iterator edge_iter;
	typedef std::vector<adj_edge> graph_type;
//	enum { inf = 1 << 28 };
	static const value_type inf;

	shortest_path_faster_algorithm(size_type n) : n(n)
	{
		graph.resize(n);
		dist.resize(n);
		in_queue.resize(n);
		count_into_que.resize(n);
		dq_size = 2 * n;
		dq.resize(dq_size);
	}

	void add_edge(size_type from, size_type to, value_type cost)
	{
		graph[from].push_back(edge(from, to, cost));
	}

	value_type spfa(size_type source, size_type target)
	{
		std::fill(dist.begin(), dist.end(), +inf);
		std::fill(in_queue.begin(), in_queue.end(), false);
		std::fill(count_into_que.begin(), count_into_que.end(), 0);
		clear();
		push_back(source);
		dist[source] = 0;
		in_queue[source] = true;
		count_into_que[source]++;
		while (!empty()) {
			size_type now = front();
			in_queue[now] = false;
			pop_front();

			for (edge_iter it = graph[now].begin(); it != graph[now].end(); ++it) {
				size_type v = it->to;
				value_type c = it->cost;
				if (dist[v] > dist[now] + c) {
					dist[v] = dist[now] + c;
					if (!in_queue[v]) {
						if (count_into_que[v] >= n) return -inf;
						if (!empty() && dist[v] < dist[front()])
							push_front(v);
						else
							push_back(v);
						in_queue[v] = true;
						count_into_que[v]++;
					}
				}
			}
		}
		return dist[target];
	}

// private:
	size_type next(int x) { return (x + 1) % dq_size; }
	size_type prev(int x) { return (x + dq_size - 1) % dq_size; }
	void clear() { head = tail = 0; }
	bool empty() { return head == tail; }
	size_type front() { return dq[head]; }
	void push_back(size_type x) { dq[tail] = x; tail = next(tail); }
	void push_front(size_type x) { dq[head = prev(head)] = x; }
	void pop_front() { head = next(head); }

	graph_type graph;
	size_type n;
	size_type dq_size;
	size_type head, tail;
	std::vector<size_type> dq;
	std::vector<size_type> count_into_que;
	std::vector<value_type> dist;
	std::vector<char> in_queue; // FIXME std::vector<bool>;
};
template <class T>
const typename shortest_path_faster_algorithm<T>::value_type shortest_path_faster_algorithm<T>::inf = 1 << 28; // FIXME

int const maxn = 676; // 26 * 26 = 676
int const source = 676;
double const eps = 0.00001;
int n;
std::string s;

shortest_path_faster_algorithm<double> sp(maxn + 4);

int hash(char a, char b)
{
	return (a - 'a') * 26 + b - 'a';
}

void add_delta(shortest_path_faster_algorithm<double>::graph_type & g, double delta)
{
	for (int i = 0; i < maxn; i++)
		for (int j = 0; j < (int)g[i].size(); j++)
			g[i][j].cost += delta;
}

bool negative_loop(double delta)
{
	add_delta(sp.graph, delta);
	bool has_negative_loop = sp.spfa(source, 0) <= -sp.inf; // FIXME
	add_delta(sp.graph, -delta);
	return has_negative_loop;
}

void clear_graph()
{
	for (int i = 0; i < maxn; i++)
		sp.graph[i].clear();
}

int main()
{
	std::ios::sync_with_stdio(false);
	for (int i = 0; i < maxn; i++)
		sp.add_edge(source, i, 0);
	while (std::cin >> n && n) {
		clear_graph();
		int max_len = 0;
		for (int i = 0; i < n; i++) {
			std::cin >> s;
			int len = s.size();
			max_len = std::max(max_len, len);
			if (len < 2) continue;
			sp.add_edge(hash(s[0], s[1]), hash(s[len - 2], s[len - 1]), -len);
		}

		double l = 0.0, r = max_len + 1.0;
		while (l + eps <= r) {
			double mid = (l + r) / 2.0;
			if (negative_loop(mid)) l = mid;
			else					r = mid;
		}
		if (l <= eps)
			std::cout << "No solution.\n";
		else
			std::cout << std::fixed << std::setprecision(2) << int(r*100)/100.0 << '\n';
	}
}

